<?php

namespace App\model;

use DateTimeInterface;
use Illuminate\Database\Eloquent\model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Base extends Model
{
    protected $guarded = [];
    protected $dateFormat = 'Y-m-d H:i:s';
    use SoftDeletes;
    protected function asJson($value)
    {
        return json_encode($value,JSON_UNESCAPED_UNICODE);
    }
    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }

    public function createdUser(){
        return $this->belongsTo(EmployeeModel::class,'created_by','id');
    }

    public function updatedUser(){
        return $this->belongsTo(EmployeeModel::class,'updated_by','id');
    }

    public function deletedUser(){
        return $this->belongsTo(EmployeeModel::class,'deleted_by','id');
    }

}
